// Package coding_round_1 18-98
// @Title coding_round_1
// @Description
// @Author  == 琳琳也叫王木木 ==  2021/9/10 9:26
// @Create  2021/9/10 9:26
package coding_round_1

import "math"

func helper(node *TreeNode, lower, upper int) bool {
	if node == nil {
		return true
	}
	if node.Val <= lower || node.Val >= upper {
		return false
	}
	return helper(node.Left, lower, node.Val) && helper(node.Right, node.Val, upper)
}
func IsValidBST(root *TreeNode) bool {
	return helper(root, math.MinInt64, math.MaxInt64)
}
